package com.bruce.controller;

import com.bruce.model.SysUser;
import com.bruce.service.SysService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
public class HomeController {
    @Autowired
    private SysService sysService;

    @RequestMapping(value="/",method = RequestMethod.GET)
    public ModelAndView index(Model model) {
        ModelAndView mav = new ModelAndView();
        List<SysUser> user = sysService.getSysUserList();
        mav.addObject("user", user);
        mav.addObject("name", "test");
        mav.setViewName("index");
        return mav;
    }
}
